package com.pai4j.common.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 *   消息常量
 *
 * @author: CYM-pai
 * @date: 2025/10/31 14:48
 **/
public class MessageConstants {

    /**
     * 系统发送的消息，系统用户
     */
    public static final String FROM_SYSTEM = "SYSTEM";

    /**
     * 消息分类
     */
    @Getter
    @AllArgsConstructor
    public enum CategoryEnum {

        SYSTEM("系统消息"),

        COMMENT_REPLY("评论与回复"),

        LIKE_COLLECT("点赞与收藏"),

        FOCUS("粉丝关注");

        private String categoryName;

        public String getCategory() {
            return this.name();
        }
    }

    public static String getCategoryName(String category) {
        if (StringUtils.isBlank(category)) {
            return "";
        }
        for (CategoryEnum categoryEnum : CategoryEnum.values()) {
            if (categoryEnum.getCategory().equals(category)) {
                return categoryEnum.getCategoryName();
            }
        }
        return "";
    }

    /**
     * 消息类型
     */
    @Getter
    @AllArgsConstructor
    public enum TypeEnum {

        LIKE("点赞"),

        LIKE_COMMENT("评论的点赞"),

        COLLECT("收藏"),

        COMMENT("评论"),

        REPLY("回复"),

        FOCUS("新粉丝关注"),

        PICK("内容加精"),

        TOP("内容置顶"),

        RECOMMEND("内容推荐"),

        INTEGRAL_UPDATE("积分变动"),

        MEDAL_AWARD("徽章授予"),

        KICK_BACK("佣金入账"),

        REVIEW_TASK_NOTIFY("资源审核催办"),

        REVIEW_RESULT_NOTIFY("资源审核结果通知"),

        ACTIVITY_NOTIFY("活动通知"),

        OTHER("其他消息");

        private String typeName;

        public String getType() {
            return this.name();
        }
    }

    public static String getTypeName(String type) {
        if (StringUtils.isBlank(type)) {
            return "";
        }
        for (TypeEnum typeEnum : TypeEnum.values()) {
            if (typeEnum.getType().equals(type)) {
                return typeEnum.getTypeName();
            }
        }
        return "";
    }
}
